<template>
  <!--客服页面-->
  <div>
    <p class="text" v-html="CustomerService.configVal"></p>
  <!--  <p><img src="../../../assets/kefubanner.png" alt="" width="100%"></p>-->
    <ul class="calllist">
      <li @click=" isshow=true">
        <p><img src="../../../assets/call1.png" alt="" width="30"></p>
        <ul>
          <li>{{HoursHotline24.remark}}</li>
          <li>{{HoursHotline24.configVal}}</li>
        </ul>
        <p @click="goTell(HoursHotline24.configVal)">拨打</p>
      </li>
      <li @click=" isshow=true">
        <p><img src="../../../assets/call1.png" alt="" width="30"></p>
        <ul>
          <li>{{ServicePhone.remark}}</li>
          <li>{{ServicePhone.configVal}}</li>
        </ul>
        <p @click="goTell(ServicePhone.configVal)">拨打</p>
      </li>
    </ul>
    <div class="model" v-show="isshow">
      <div class="bg"></div>
      <div class="modelContent">
        <img src="../../../assets/close.png" alt="" width="15" @click="isshow=false" class="close">
        <ul class="list">
          <li><img src="../../../assets/tell.png" alt="" width="22">{{phone}}</li>
          <li>是否拨打？</li>
        </ul>
        <p class="btn">
          <button class="call" @click="goCallTellPhone(phone)">拨打</button>
          <button class="cancel" @click="isshow=false">取消</button>
        </p>
      </div>
    </div>
  </div>
</template>

<script type="text/ecmascript-6">
  import {getKefuinfo} from '../../../../test/unit/http'
  import {Toast} from 'we-vue'
  export default {
    name: 'kefu',
    props: {},
    data() {
      return {
        isshow: false,
        CustomerService: {},
        HoursHotline24: {},
        ServicePhone: {},
        phone:''
      };
    },
    methods: {
      getKefuInfoData(params){
          var that =this;
        getKefuinfo(params).then(res => {
          console.log(res);
          if (res.code == 100) {
            that.CustomerService=res.object.CustomerService;
            that.HoursHotline24=res.object.HoursHotline24;
            that.ServicePhone=res.object.ServicePhone;
          } else {

          }
        })
      },
      goTell(phone){
         this.phone=phone;
      },
      goCallTellPhone(tellPhone){
        window.location.href = 'tel://' + tellPhone
      }
    },
    created() {
      this.getKefuInfoData({});
    },
    components: {}
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less" rel="stylesheet/less">
  .bg {
    background-color: rgba(0, 0, 0, 0.3);
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 50px;
  }

  .model .modelContent {
    background-color: #fff;
    border-radius: 8px;
    position: fixed;
    left: 50%;
    top: 50%;
    margin-left: -43%;
    margin-top: -111px;
    z-index: 2;
    padding: 30px 10px 20px;
    width: 80%;
    font-size: 16px;
    color: #111;
    .close {
      position: absolute;
      right: 10px;
      top: 10px
    }
    .list {
      font-size: 15px;
      margin-bottom: 20px;
      li:first-child {
        color: #56a7ed;
        margin-bottom: 5px;
        img {
          vertical-align: middle;
          margin-right: 5px;
        }
      }
    }
    .btn {
      button {
        height: 42px;
        line-height: 42px;
        color: #fff;
        outline: none;
        border: none;
        width: calc(50% - 20px);
        border-radius: 8px;
      }
      .call {
        background-color: #2e94f0;
        margin-right: 20px;
      }
      .cancel {
        background-color: #ccc;
      }
    }

  }

  p {
    padding: 10px;
  }

  .text {
    color: #666;
    line-height: 25px;
    text-indent: 30px;
    text-align: left;
  }

  .calllist {
    > li {
      display: flex;
      text-align: left;
      border: 1px solid #ddd;
      border-radius: 10px;
      margin: 10px 10px 20px;
      padding-top: 5px;
      p {
        flex: 0 10%;
      }
      ul {
        flex: 0 66%;
        li:first-child {
          font-size: 16px;
          color: #111;
        }
        li:last-child {
          color: #2e94f0;
          font-size: 13px;
        }
      }
      p:last-child {
        font-size: 16px;
        color: #2e94f0;
      }
    }
  }
</style>
